/*
Material autoset by face name. If face material cannot be found then load a default material.
Material face name should be able to be over-written IE matGroup.setMaterial(someOtherMaterial)
Heavily linked with entity engine

every loop the basics

set texture(matTex)
set material(matSha)
for each material variable
	set material variable(var[x],val[x])
draw mat group

then ability to change matgroup name on mesh

THE MATERIAL CLASS WILL BE IN ENTITY!!!! AS SUCH IT IS NOT AN ENGINE AND SHOULD NOT BE NAMED SO!
IT SHOULD BE A MANAGER, THAT JUST HOLDS THE DATA FOR ENTITY OR WHATEVER!!!
*/
#ifndef MATERIALMANAGER_H
#define MATERIALMANAGER_H

#include <string>
#include <vector>

#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/path.hpp>
struct var
{
	std::string variable;
	float value;
};
struct mat
{
	std::string name;
	int cRed, cGre, cBlu;
	std::string texID;
	std::string shaderID;
	std::vector<var*> shaderVariables;
};

class materialManager
{
protected:
	std::vector<mat*> material;

	materialManager();
	materialManager(const materialManager&);
	materialManager& operator =(const materialManager&);
private:
	static materialManager* pinstance;
public:
	mat* getMaterial(std::string id);

	void freeMaterial(std::string id);
	bool loadMaterial(std::string path);

	static materialManager* instance();
	~materialManager();
};

materialManager* MATM();

void loadMaterialDirectory(const boost::filesystem::path & directory, bool recurse_into_subdirs);

#endif